<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Jobs\RegionsDataJob;

class RegionDataCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'collect:regionDataCmd';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'collect regionData';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $params = array(
            'factory_conn' => "sqlsrv—yongqiang2",
            'remote_conn' => "sqlsrv",
            'factory_data_table' => "Region",
            'remote_data_table' => "WR_Region_yongqiang2"
        );

        dispatch(new RegionsDataJob($params));
        return 0;
    }
}
